$.mockjax({
    url: bathpath + 'v1/user/login',
    contentType: "application/json",
    responseTime: 500,
    response: function (req) {
        var username = req.data.username
        role = ''
        switch (username) {
            case 'user1':
                role = 'user1'
                break;
            case 'user2':
                role = 'user2'
                break;
            case 'user3':
                role = 'user3'
                break;
            case 'customer':
                role = 'bigCustomer'
                break;

            case 'waiter':
                role = 'waiter'
                break;

            case 'boss':
                role = 'boss'
                break;
            case 'driver':
                role = 'driver'
                break;
            case 'user_management':
                role = 'user_management'
                break;
            case 'wangzhongli':
                role = 'wangzhongli'
                break;
            case 'wangbin':
                role = 'wangbin'
                break;
            default:
                break;
        }
        this.responseText = {
            "code": 1,
            "msg": "操作成功",
            "errorMsg": null,
            "content": {
                user: {
                    role: role,
                    username: username
                }
            }
        }
    }
})

$.mockjax({
    url: bathpath + 'v1/menu/user1',
    contentType: "application/json",
    responseTime: 500,
    responseText: {
        "code": 1,
        "msg": "操作成功",
        "errorMsg": null,
        "content": [
            { name: '首页', url: 'a.html',items:[
                {name: '基本信息', url: 'a.html'},
                {name: '待办事宜', url: 'a.html'},
                {name: '统计数据', url: 'a.html'}
            ] },
            { name: '科技贷申请', url: 'a.html' },
            { name: '科技保申请', url: 'a.html'},
            { name: '股权融资申请', url: 'a.html'},
            { name: '活动申请', url: 'a.html'},
            { name: '服务平台申请', url: 'a.html'},
            { name: '企业/金融机构管理', url: 'a.html'},
            { name: '我的审核', url: 'a.html'},
            { name: '统计报表', url: 'a.html'},
            { name: '系统管理', url: 'a.html',items:[
                {name: '数据字典', url: 'a.html'},
                {name: '动态表单', url: 'a.html'},
                {name: '工作流', url: 'a.html'},
                {name: '用户管理', url: 'a.html'}
            ] },
            { name: '网站管理', url: 'a.html',items:[
                {name: '栏目', url: 'a.html'},
                {name: '新闻', url: 'a.html'},
                {name: '活动审核', url: 'a.html'}
            ] }
        ]
    }
})

$.mockjax({
    url: bathpath + 'v1/menu/user2',
    contentType: "application/json",
    responseTime: 500,
    responseText: {
        "code": 1,
        "msg": "操作成功",
        "errorMsg": null,
        "content": [
            
            { name: '企业完善资料副本', url: 'bdsq.html' },
            { name: '其他2', url: 'data_dict.html' },
            { name: '企业完善资料', url: 'company-1.html' },
            { name: '企业修改资料', url: 'company-2.html' },
            { name: '企业详细资料', url: 'company-3.html' }
        ]
    }
})
$.mockjax({
    url: bathpath + 'v1/menu/user3',
    contentType: "application/json",
    responseTime: 500,
    responseText: {
        "code": 1,
        "msg": "操作成功",
        "errorMsg": null,
        "content": [
            { name: '动态表单', url: 'catch.html' },
            { name: '工作流', url: 'catch.html' }
        ]
    }
})
$.mockjax({
    url: bathpath + 'v1/menu/tom',
    contentType: "application/json",
    responseTime: 500,
    responseText: {
        "code": 1,
        "msg": "操作成功",
        "errorMsg": null,
        "content": [
            { name: 'zhua', url: 'catch.html' }
        ]
    }
})
$.mockjax({
    url: bathpath + 'v1/menu/admin',
    contentType: "application/json",
    responseTime: 500,
    responseText: {
        "code": 1,
        "msg": "操作成功",
        "errorMsg": null,
        "content": [
            { name: '首页123123123', url: 'admin.html' }
        ]
    }
})

$.mockjax({
    url: bathpath + 'v1/menu/driver',
    contentType: "application/json",
    responseTime: 500,
    responseText: {
        "code": 1,
        "msg": "操作成功",
        "errorMsg": null,
        "content": [
            { name: '首页', url: 'driver.html' },
            { name: '我的订单', url: 'driver_order.html' },
            // { name: '个人资料', url: 'driver_info.html' },
            // { name: '个人资料123', url: 'driver_info.html' }
        ]
    }
})

$.mockjax({
    url: bathpath + 'v1/menu/bigCustomer',
    contentType: "application/json",
    responseTime: 500,
    responseText: {
        "code": 1,
        "msg": "操作成功",
        "errorMsg": null,
        "content": [
            { name: '首页', url: 'bigCustomer.html', icon: 'fa-tachometer' },
            { name: '我的订单', url: 'bigCustomer_order.html', icon: 'fa-bus' },
            { name: '我的订123单', url: 'bigCustomer_order.html', icon: 'fa-bus' },
            { name: '我的订单123', url: 'bigCustomer_order.html', icon: 'fa-bus' }
        ]
    }
})

$.mockjax({
    url: bathpath + 'v1/menu/waiter',
    contentType: "application/json",
    responseTime: 500,
    responseText: {
        "code": 1,
        "msg": "操作成功",
        "errorMsg": null,
        "content": [
            { name: '首页', url: 'waiter.html' },
            { name: '司机管理', url: 'waiter_dirverMgr.html' }
        ]
    }
})


$.mockjax({
    url: bathpath + 'v1/menu/boss',
    contentType: "application/json",
    responseTime: 500,
    responseText: {
        "code": 1,
        "msg": "操作成功",
        "errorMsg": null,
        "content": [
            { name: '仪表盘', url: 'dashboard.html' }
        ]
    }
})


// ------- order mgr
$.mockjax({
    url: bathpath + 'v1/order/list',
    contentType: "application/json",
    responseTime: 500,
    response: function (req) {
        this.responseText = {
            "code": 1,
            "msg": "操作成功",
            "errorMsg": null,
            "content": [{
                id: '10000001',
                vehicleType: '1', // 车辆类型 1箱货(1.1-4.2m 1.2-6.8米) 2高栏 3中巴 4大面包
                needHanding: '0', // 需要装卸 1只卸不装 2只装不卸 3装卸
                isMulti: '1', // 多点配送
                agingIn: '1', // 装货时效 1加急 2普通
                agingOut: '1', // 送货时效 1高速 2普通
                isReturn: '1', // 返仓 1反 2不反
                returnCharge: 0, // 返仓收费金额
                paymentType: '1', // 1月结 2现结
                distanceType: '1', // 距离类型 1长途 2短途
                status: '0', // 订单状态 0下单 1接单 2收货 3运中 4运达 5已付款
                created: '2017-10-12 14:51:30', // 下单时间
                time1: '2017-10-12 14:51:30', // 接单
                time2: '2017-10-12 14:51:30', // 收货
                time3: '2017-10-12 14:51:30', // 开始运货
                time4: '2017-10-12 14:51:30', // 送达
                time5: '2017-10-12 14:51:30', // 付款
                addrIn: '祈福中华小区西门',
                goodsType: '1', // 货物类型 1立方 2吨
                goodsCount: 200.13, // 货物计量
                dispatchDetail: [{
                    addr: '燕庄社区服务站',
                    notes: '箱货 100箱',
                    contactName: '联系人',
                    contactPhone: '13355124444',
                    dirvers: [{
                        id: 10000001,
                        name: '张三',
                        level: '5'
                    }]
                }, {
                    addr: 'CBD博览中心 C 口',
                    notes: '办公家具 1300kg,10立方,25件',
                    contactName: '联系人',
                    contactPhone: '13355124444',
                    dirvers: [{
                        id: 10000001,
                        name: '张三',
                        level: '5'
                    }]
                }, {
                    addr: 'CBD博览中心 D 口',
                    notes: '办公家具 1300kg,10立方,25件',
                    contactName: '联系人',
                    contactPhone: '13355124444',
                    dirvers: [{
                        id: 10000001,
                        name: '张三',
                        level: '5'
                    }]
                }],
                drivers: [{
                    id: 10000001,
                    name: '张三',
                    level: '5',
                    detail: [{
                        addr: 'CBD博览中心 C 口',
                        notes: '办公家具 1300kg,10立方,25件'
                    }, {
                        addr: 'CBD博览中心 D 口',
                        notes: '办公家具 1300kg,10立方,25件'
                    }]
                }, {
                    id: 10000002,
                    name: '李四',
                    level: '5',
                    detail: [{
                        addr: '燕庄社区服务站',
                        notes: '箱货 100箱'
                    }]
                }]
            }]
        }
    }
})
//


$.mockjax({
    url: bathpath + 'v1/menu/user_management',
    contentType: "application/json",
    responseTime: 500,
    responseText: {
        "code": 1,
        "msg": "操作成功",
        "errorMsg": null,
        "content": [
            { name: '菜单管理', url: 'user_management/menutree.html' },
            { name: '用户角色管理', url: 'user_management/user_role.html' },
            { name: '用管理', url: 'user_management/user_bm.html' },
            // { name: '个人资料', url: 'driver_info.html' },
            // { name: '个人资料123', url: 'driver_info.html' }
        ]
    }
})
//用户菜单
$.mockjax({
    url: bathpath + 'v1/menu/wangzhongli',
    contentType: "application/json",
    responseTime: 500,
    responseText: {
        "code": 1,
        "msg": "操作成功",
        "errorMsg": null,
        "content": [
            { name: '用户权限管理', url: 'user_management/user_ma.html' },
            { name: '菜单管理', url: 'user_management/menutree.html' },
            { name: '用户角色管理', url: 'user_management/user_role.html' },
            { name: '修改密码', url: 'user_management/modify_pass.html' },
            { name: '企业资料', url: 'user_management/company_basic_info.html' },
            { name: '企业资料详细', url: 'user_management/company_info.html' },
            { name: '个人资料修改', url: 'user_management/modify_user_info.html' },
            { name: '用户认证管理', url: 'user_management/user_approve_management.html' },
        ]
    }
})

//角色列表
$.mockjax({
    url: bathpath + 'v1/user_management/get_roles',
    contentType: "application/json",
    responseTime: 500,
    response: function (req) {
        this.responseText = {
            "code": 1,
            "msg": "操作成功",
            "errorMsg": null,
            "content": [
                //角色id、角色名称、角色排序、部门备注
                { role_id: '778', role_name: '角色名称1', role_sort: 1, role_dec: '角色说明1' },
                { role_id: '779', role_name: '角色名称2', role_sort: 1, role_dec: '角色说明2' },
                { role_id: '780', role_name: '角色名称3', role_sort: 1, role_dec: '角色说明3' },
                { role_id: '781', role_name: '角色名称4', role_sort: 1, role_dec: '角色说明4' },
                { role_id: '778', role_name: '角色名称1', role_sort: 1, role_dec: '角色说明1' },
                { role_id: '779', role_name: '角色名称2', role_sort: 1, role_dec: '角色说明2' },
                { role_id: '780', role_name: '角色名称3', role_sort: 1, role_dec: '角色说明3' },
                { role_id: '781', role_name: '角色名称4', role_sort: 1, role_dec: '角色说明4' },
                { role_id: '778', role_name: '角色名称1', role_sort: 1, role_dec: '角色说明1' },
                { role_id: '779', role_name: '角色名称2', role_sort: 1, role_dec: '角色说明2' },
                { role_id: '780', role_name: '角色名称3', role_sort: 1, role_dec: '角色说明3' },
                { role_id: '781', role_name: '角色名称4', role_sort: 1, role_dec: '角色说明4' },
            ]
        }
    }
})
//修改角色名称
$.mockjax({
    url: bathpath + 'v1/user_management/modify_role',
    contentType: "application/json",
    responseTime: 500,
    response: function (req) {
        var role_name = req.data.role_name;
        var role_id = req.data.role_id;
        var role_dec = req.data.role_dec;
        var role_sort = req.data.role_sort;
        this.responseText = {
            "code": 1,
            "msg": "操作成功",
            "errorMsg": null,
            "content": [
                //角色id、角色名称、角色排序、部门备注
                { role_id: '778', role_name: '角色名称1', role_sort: 1, role_dec: '角色说明1' },
            ]
        }
    }
})
//部门列表
$.mockjax({
    url: bathpath + 'v1/user_management/get_departments',
    contentType: "application/json",
    responseTime: 500,
    responseText: {
        "code": 1,
        "msg": "操作成功",
        "errorMsg": null,
        "content": [
            //部门id、部门名称、部门父id、部门备注
            { department_id: '778', department_name: '部门名称1', department_pid: '778', department_dec: '部门说明1' },
            { department_id: '779', department_name: '部门名称2', department_pid: '778', department_dec: '部门说明2' },
            { department_id: '738', department_name: '部门名称3', department_pid: '778', department_dec: '部门说明3' },
            { department_id: '748', department_name: '部门名称4', department_pid: '778', department_dec: '部门说明4' },
            { department_id: '778', department_name: '部门名称1', department_pid: '778', department_dec: '部门说明1' },
            { department_id: '779', department_name: '部门名称2', department_pid: '778', department_dec: '部门说明2' },
            { department_id: '738', department_name: '部门名称3', department_pid: '778', department_dec: '部门说明3' },
            { department_id: '748', department_name: '部门名称4', department_pid: '778', department_dec: '部门说明4' },
        ]
    }
})
//部门下的人员列表
$.mockjax({
    url: bathpath + 'v1/user_management/users_by_department_id',
    contentType: "application/json",
    responseTime: 500,
    response: function (req) {
        var department_id = req.data.department_id;
        console.log("返回" + department_id);
        this.responseText = {
            "code": 1,
            "msg": "操作成功",
            "errorMsg": null,
            "content": [
                {
                    department_id: '778', user_id: '2344', user_name: 'wangzhongli', user_position: '职务', user_position_z: '职称', user_team_type: '团队类型', user_team_unit: '工作单位',
                    user_location: '工作所在地', user_phone: '13781067650', user_email: 'hhhhhh@qq.com', user_type: '用户类型1'
                },
                {
                    department_id: '778', user_id: '2344', user_name: 'wangzhongli', user_position: '职务', user_position_z: '职称', user_team_type: '团队类型', user_team_unit: '工作单位',
                    user_location: '工作所在地', user_phone: '13781067650', user_email: 'hhhhhh@qq.com', user_type: '用户类型2'
                },
                {
                    department_id: '778', user_id: '2344', user_name: 'wangzhongli', user_position: '职务', user_position_z: '职称', user_team_type: '团队类型', user_team_unit: '工作单位',
                    user_location: '工作所在地', user_phone: '13781067650', user_email: 'hhhhhh@qq.com', user_type: '用户类型3'
                },
                {
                    department_id: '778', user_id: '2344', user_name: 'wangzhongli', user_position: '职务', user_position_z: '职称', user_team_type: '团队类型', user_team_unit: '工作单位',
                    user_location: '工作所在地', user_phone: '13781067650', user_email: 'hhhhhh@qq.com', user_type: '用户类型4'
                },

            ]
        }
    }
})
//修改密码
$.mockjax({
    url: bathpath + 'v1/user/modify_pass',
    contentType: "application/json",
    responseTime: 500,
    response: function (req) {
        var user_id = req.data.user_id;
        var oldPassword = req.data.oldPassword;
        var newPassword = req.data.newPassword;
        console.log("返回oldPassword" + oldPassword + "----newPassword=" + newPassword);
        this.responseText = {
            "code": 1,
            "msg": "操作成功",
            "errorMsg": null,
            "content": [

            ]
        }
    }
})
//注册
$.mockjax({
    url: bathpath + 'v1/user/register',
    contentType: "application/json",
    responseTime: 500,
    response: function (req) {
        var user_name = req.data.user_name;
        var password = req.data.password;
        var user_unit_name = req.data.user_unit_name;
        var user_email = req.data.user_email;
        var user_contact = req.data.user_contact;
        var user_phone = req.data.user_phone;
        var user_tel = req.data.user_tel;
        console.log("返回user_name" + user_name);
        this.responseText = {
            "code": 1,
            "msg": "操作成功",
            "errorMsg": null,
            "content": {
                user: {
                    user_name: user_name,
                    user_unit_name: user_unit_name
                }
            }
        }
    }
})
//修改个人资料
$.mockjax({
    url: bathpath + 'v1/user/modify_user_info',
    contentType: "application/json",
    responseTime: 500,
    response: function (req) {
        var user_name = req.data.user_name;
        var user_id = req.data.user_id;
        var user_unit_name = req.data.user_unit_name;
        var user_email = req.data.user_email;
        var user_contact = req.data.user_contact;
        var user_phone = req.data.user_phone;
        var user_tel = req.data.user_tel;
        console.log("返回user_name" + user_unit_name);
        this.responseText = {
            "code": 1,
            "msg": "操作成功",
            "errorMsg": null,
            "content": {
                user: {
                    user_name: user_name,
                    user_unit_name: user_unit_name
                }
            }
        }
    }
})

//修改个人资料
$.mockjax({
    url: bathpath + 'v1/user/modify_user_info',
    contentType: "application/json",
    responseTime: 500,
    response: function (req) {
        var user_name = req.data.user_name;
        var user_id = req.data.user_id;
        var user_unit_name = req.data.user_unit_name;
        var user_email = req.data.user_email;
        var user_contact = req.data.user_contact;
        var user_phone = req.data.user_phone;
        var user_tel = req.data.user_tel;
        console.log("返回user_name" + user_unit_name);
        this.responseText = {
            "code": 1,
            "msg": "操作成功",
            "errorMsg": null,
            "content": {
                user: {
                    user_name: user_name,
                    user_unit_name: user_unit_name
                }
            }
        }
    }
})



$.mockjax({
    url: bathpath + 'v1/menu/wangbin',
    contentType: "application/json",
    responseTime: 500,
    responseText: {
        "code": 1,
        "msg": "操作成功",
        "errorMsg": null,
        "content": [
            { name: '发布活动审核', url: '' },
            { name: '发布活动', url: 'sys-page/activity/index.html' },
            { name: '活动预览', url: '' },
            { name: '企业-发布活动', url: 'sys-page/company_activity/activity.html' },
            { name: '企业-活动预览', url: '' },
            { name: '活动发布管理', url: 'sys-page/company_activity/activityPreview.html.html' },
        ]
    }
})
